8. 특정 품종에 대한 총 판매수량과 금액을 구하라. :: 오라클 실습[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

오라클 실습
[1]
등록일:2009-05-28 00:20:36 (0%)
작성자:
제목:8. 특정 품종에 대한 총 판매수량과 금액을 구하라.
Select  sum(sale_amt)  as  total_sale_qty,
                    sum(sale_amt*a.unit_price)  as  total_sale_amt
From  product  a,  sale  b
Where  a.prod_no  =  b.prod_no
And  a.prod_class  in  (‘Foods’,  Furniture’)
And  b.saledate  between  ‘19950101’  and  ‘19950331’

(개선안)
select  sum(v.total_qty)  as  total_sale_qty,
                      sum(v.total_qty*a.unit_price)  as  total_sale_amt
from  (select  prod_no,  sum(sale_amt)  as  total_qty
                    from  sale
                    where  saledate  between  ‘19950101’  and  ‘19950331’
                    group  by  prod_no)  v,  product  a
where  a.prod_no  =  v.prod_no
      and  a.prod_class  in  (‘Foods’,  Furniture’)
[본문링크] 8. 특정 품종에 대한 총 판매수량과 금액을 구하라.
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=31514
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.